using System;
using System.IO;
using System.Text;
using OfficeOpenXml;

namespace netexcel
{
	class Program
	{
		static void Main(string[] args)
		{
			FileInfo file = new FileInfo("/qqnot.xlsx");
			using (ExcelPackage package = new ExcelPackage(file))
                {
                    StringBuilder sb = new StringBuilder();
                    ExcelWorksheet worksheet = package.Workbook.Worksheets[1];
                    int rowCount = worksheet.Dimension.Rows;
                    int ColCount = worksheet.Dimension.Columns;
                    for (int row = 1; row <= rowCount; row++)
                    {
						String userid =  worksheet.Cells[row,2].Value.ToString();

						sb.AppendFormat("UPDATE user SET userstatus = 0 ,jbz='非法抽奖用户' WHERE id = {0};",userid);
                        sb.Append(Environment.NewLine);
                    }
                    //return sb.ToString();
					//Console.WriteLine(sb.ToString());
					//Console.ReadLine();

					FileStream fs = new FileStream("/test.txt",FileMode.Create);
					byte[] data = System.Text.Encoding.Default.GetBytes(sb.ToString());
					fs.Write(data,0,data.Length);
					fs.Flush();
					fs.Close();
                }
			
		}
	}
}
